package com.yida.gwj.deposit.service.impl;

import com.yida.common.core.utils.DateUtils;
import com.yida.common.security.utils.SecurityUtils;
import com.yida.gwj.deposit.domain.GwjDepositBusinessDetail;
import com.yida.gwj.deposit.mapper.GwjDepositBusinessDetailMapper;
import com.yida.gwj.deposit.service.IGwjDepositBusinessDetailService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 业务缴存明细信息（缴存业务管理模块）Service业务层处理
 *
 * @author ruoyi
 * @date 2023-02-14
 */
@Service
public class GwjDepositBusinessDetailServiceImpl implements IGwjDepositBusinessDetailService
{
    @Resource
    private GwjDepositBusinessDetailMapper gwjDepositBusinessDetailMapper;

    /**
     * 查询业务缴存明细信息（缴存业务管理模块）
     *
     * @param depositDetailId 业务缴存明细信息（缴存业务管理模块）主键
     * @return 业务缴存明细信息（缴存业务管理模块）
     */
    @Override
    public GwjDepositBusinessDetail selectGwjDepositBusinessDetailByDepositDetailId(Long depositDetailId)
    {
        return gwjDepositBusinessDetailMapper.selectGwjDepositBusinessDetailByDepositDetailId(depositDetailId);
    }

    /**
     * 查询业务缴存明细信息（缴存业务管理模块）列表
     *
     * @param gwjDepositBusinessDetail 业务缴存明细信息（缴存业务管理模块）
     * @return 业务缴存明细信息（缴存业务管理模块）
     */
    @Override
    public List<GwjDepositBusinessDetail> selectGwjDepositBusinessDetailList(GwjDepositBusinessDetail gwjDepositBusinessDetail)
    {
        return gwjDepositBusinessDetailMapper.selectGwjDepositBusinessDetailList(gwjDepositBusinessDetail);
    }

    /**
     * 新增业务缴存明细信息（缴存业务管理模块）
     *
     * @param gwjDepositBusinessDetail 业务缴存明细信息（缴存业务管理模块）
     * @return 结果
     */
    @Override
    public int insertGwjDepositBusinessDetail(GwjDepositBusinessDetail gwjDepositBusinessDetail)
    {
	    gwjDepositBusinessDetail.setCreateBy(SecurityUtils.getLoginUser().getSysUser().getRealName());
	    gwjDepositBusinessDetail.setCreateTime(DateUtils.getNowDate());
        return gwjDepositBusinessDetailMapper.insertGwjDepositBusinessDetail(gwjDepositBusinessDetail);
    }

    /**
     * 修改业务缴存明细信息（缴存业务管理模块）
     *
     * @param gwjDepositBusinessDetail 业务缴存明细信息（缴存业务管理模块）
     * @return 结果
     */
    @Override
    public int updateGwjDepositBusinessDetail(GwjDepositBusinessDetail gwjDepositBusinessDetail)
    {
	    gwjDepositBusinessDetail.setUpdateBy(SecurityUtils.getLoginUser().getSysUser().getRealName());
	    gwjDepositBusinessDetail.setUpdateTime(DateUtils.getNowDate());
        return gwjDepositBusinessDetailMapper.updateGwjDepositBusinessDetail(gwjDepositBusinessDetail);
    }

    /**
     * 批量删除业务缴存明细信息（缴存业务管理模块）
     *
     * @param depositDetailIds 需要删除的业务缴存明细信息（缴存业务管理模块）主键
     * @return 结果
     */
    @Override
    public int deleteGwjDepositBusinessDetailByDepositDetailIds(Long[] depositDetailIds)
    {
        return gwjDepositBusinessDetailMapper.deleteGwjDepositBusinessDetailByDepositDetailIds(depositDetailIds);
    }

    /**
     * 删除业务缴存明细信息（缴存业务管理模块）信息
     *
     * @param depositDetailId 业务缴存明细信息（缴存业务管理模块）主键
     * @return 结果
     */
    @Override
    public int deleteGwjDepositBusinessDetailByDepositDetailId(Long depositDetailId)
    {
        return gwjDepositBusinessDetailMapper.deleteGwjDepositBusinessDetailByDepositDetailId(depositDetailId);
    }

    /**
     * 删除业务缴存明细信息（缴存业务管理模块）信息
     *
     * @param moneyId 分户数据管理的moneyID
     * @return 结果
     */
    @Override
    public int deleteGwjDepositBusinessDetailByMoneyId(Long moneyId)
    {
        return gwjDepositBusinessDetailMapper.deleteGwjDepositBusinessDetailByMoneyId(moneyId);
    }

    /**
     * 查询业务缴费明细信息集合（缴存业务管理模块）
     * @param bizId 业务主键
     * @return
     */
    @Override
    public List<GwjDepositBusinessDetail> selectGwjDepositBusinessDetailByBizId(Long bizId) {
        return gwjDepositBusinessDetailMapper.selectGwjDepositBusinessDetailByBizId(bizId);
    }

    /**
     * 批量插入业务缴存明细信息
     * @param details 业务缴存明细信息
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int insertBatchGwjDepositBusinessDetail(List<GwjDepositBusinessDetail> details) {
        return gwjDepositBusinessDetailMapper.insertBatchGwjDepositBusinessDetail(details);
    }

    /**
     * 批量删除业务缴存明细信息
     * @param bizId 业务主键
     * @return
     */
    @Override
    public int deleteBatchGwjDepositBusinessDetailByBizId(Long bizId) {
        return gwjDepositBusinessDetailMapper.deleteBatchGwjDepositBusinessDetailByBizId(bizId);
    }
}
